﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PersonaLibrary.Data;
using PersonaLibrary.Data.ServiceReference;
using PersonaLibrary.View;
using Note = PersonaLibrary.PersonaliiReference.Note;

namespace PersonaLibrary.Commands.EditCommands
{
    internal sealed class EmployeeDelete : CommandBase
    {
        public override bool CanExecute(object parameter)
        {
            return parameter is int;
        }

        public override void Execute(object parameter)
        {
			DeleteView deleteView = new DeleteView();
			deleteView.ShowDialog();
			if (deleteView.DialogResult.HasValue && deleteView.DialogResult.Value)
			{
				DataServiceContextWrapper context = new DataServiceContextWrapper();
				context.CreateAndExecuteQuery<Note>(string.Format("FullDeleteEmployee?employeeId={0}", parameter));
			}
        }
    }
}
